package com.bw.exam.pojo.response;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author: liuzhiping
 * @date: 2024/7/18 15:09
 **/

@Data
public class R {

    private int status = 200;
    private boolean flag = true;
    private String message = "操作成功";
    private Object data;
    private Integer code;

    public static R success(Object data){
        R r = new R();
        r.setStatus(1);
        r.setData(data);
        r.setCode(200);
        return r;
    }
    public static R success(){
        R r = new R();
        r.setMessage("success");
        r.setStatus(1);
        r.setCode(200);
        return r;
    }

    public static R fail(){
        R r = new R();
        r.setMessage("fail");
        r.setStatus(0);
        r.setCode(500);
        return r;
    }

}
